const { lastIndexOf } = require("lodash");

const obj = {
  name: "zgl",
  log() {
    console.log(this.name);
  },
};
obj.log();

const obj2 = {
  name: "zce",
  log: "hello",
};

const result = Object.assign(obj, obj2);

// console.log(obj, obj === result);

const r = Object.is(-0, +0);

const foo = "123";
const bar = "114";

const obj = {
  [foo]: 1,
  [bar]: 2,
};

console.log(obj);

const m = new Map();
m.set(foo, 11);
m.set(bar, 22);

for (var i = 0; i < 3; i++) {}
console.log("i:", i);

for (let j = 0; j < 3; j++) {}
console.log("j:", j);

var a = {
  count: 0,
};
console.log(a);
a.count++;
class CC {
  constructor(name) {
    this.name = name;
  }
}
const arr = [
  new CC("hikalu1"),
  new CC("hikalu2"),
  new CC("hikalu3"),
  new CC("hikalu4"),
];

console.log(arr);
setTimeout(() => {
  arr.pop();
}, 30);

var a = [];
for (var i = 0; i < 10; i++) {
  a[i] = function () {
    console.log(i);
  };
}
a[6]();

var tmp = 123;
if (true) {
  console.log(tmp);
  let tmp;
}

//------
const arr = [12, 34, 32, 89, 4];
let a = arr.sort((a, b) => a - b)[0];
console.log(a);

//------
var a = 10;
var obj = {
  a: 20,
  fn() {
    setTimeout(() => {
      console.log(this.a);
    });
  },
};
obj.fn();